package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	g := gin.Default()
	g.GET("/", GetResults)
	g.POST("/post", PostResults)
	g.POST("/postVrible/:name", PathVrible)
	g.Run()
}
func PathVrible(g *gin.Context) {
	name := g.Param("name")
	g.JSON(http.StatusOK, gin.H{
		"name": name,
	})
}
func PostResults(g *gin.Context) {
	name := g.PostForm("name")
	name1 := g.DefaultPostForm("name1", "test")
	g.JSON(http.StatusOK, gin.H{
		"name":  name,
		"name1": name1,
	})
}
func GetResults(g *gin.Context) {
	name := g.Query("name")
	name1 := g.DefaultQuery("name", "test")
	g.JSON(http.StatusOK, gin.H{
		"name":  name,
		"name1": name1,
	})
}
